/**
 * @param {number[]} numbers
 * @param {number} target
 * @return {number[]}
 */
var twoSum = function(numbers, target) {
  let i = 0, j = numbers.length - 1;
  while(i < j) {
    if(numbers[i] + numbers[j] > target) {
      j--;
    } else if(numbers[i] + numbers[j] < target) {
      i++;
    } else {
      return [i + 1, j + 1];
    }
  }
};
let numbers = [2,7,11,15], target = 9;
console.log(twoSum(numbers, target));
numbers = [2,3,4], target = 6;
console.log(twoSum(numbers, target));
numbers = [-1,0], target = -1;
console.log(twoSum(numbers, target));
